Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Using dict or string to set browser location to any arbitrary location - #33

Merged
ChrisKnott merged 4 commits into
python-eel:masterfrom
ahopkins:master
Apr 3, 2018
Merged

ChrisKnott merged 4 commits into
python-eel:masterfrom
ahopkins:master

Conversation

@ahopkins

@ahopkins ahopkins commented Mar 8, 2018

Copy link
Copy Markdown
Contributor

I did two things in the PR. Let me know if this makes sense for you.

  1. I went through and reformatted some things to make everything PEP8 compliant.
  2. I changed the API for eel.start to accept arguments either in string or dict fashion.
eel.start('/mypage.html', options=options)

Or

mypage = {
    'scheme': 'https',
    'host': 'myhost',
    'port': 8888,
    'page': 'mypage.html'
}
eel.start(mypage, options=options)

This would open the browser to https://myhost:8888/page.html.

If opting for using the dict the defaults for each are as follows:

dict(
    scheme='http',
    host='localhost',
    port=8000,
    page=''
)

The goal of this was to allow for the browser session to render a page NOT served by the bottle server. This is accomplished by allowing the user to specify any arbitrary location. The effect of this is to allow applications to be built using webpack (example, react or vue).

However, in order to accomplish this on the frontend, I needed to add a method to the JS.

Therefore, if the browser is to render a page not server by bottle, then the user needs to explicitly call

eel.set_host('ws://localhost:8080')

@ahopkins

ahopkins commented Mar 8, 2018

Copy link
Copy Markdown
Contributor Author

See #30. This solves half the problem.

@ChrisKnott

Copy link
Copy Markdown
Collaborator

@ahopkins Thanks for the pull request, I will review it today. Sorry for inactivity, I've been on holiday for a few weeks

@ChrisKnott
ChrisKnott merged commit 507879d into python-eel:master Apr 3, 2018
@ahopkins

ahopkins commented Apr 3, 2018

Copy link
Copy Markdown
Contributor Author

No worries! I'm on a little break myself now. And I'll probably pick back up my project using Eel next week.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants